home *** CD-ROM | disk | FTP | other *** search
- /*
- * QPDEMO.C - qprintf and qputch demo - Jeff R. Fontanesi, 7/3/89
- */
-
- #include <stdio.h>
- #include <conio.h>
- #include "qprintf.h"
-
- void qpdemo(void); /* Demo routine using qprintf and qputch */
- void cpdemo(void); /* Demo routine using cprintf and putch */
-
-
- main()
- {
- qp_init(); /* Initialize qprintf and qputch */
- clrscr();
-
- qprintf(20,13,7,"Demo using cprintf and putch (press a key)");
- getch();
-
- cpdemo(); /* Do the cprintf and putch demo */
-
- qprintf(20,13,7,"Demo using qprintf and qputch (press a key)");
- getch();
-
- qpdemo(); /* Do the qprintf and qputch demo */
- }
-
-
- void qpdemo(void)
- {
- int x,y,j,k,m,n;
- char *msg1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- char *msg2 = "abcdefghijklmnopqrstuvwxyz";
- char *msg3 = "0123456789";
-
- /* Print 15 screens in different colors using qprintf*/
-
- for (j = 1; j <= 15; j++)
- for (y = 1; y <= 25; y++)
- qprintf(1,y,j,"Color: %2d - %s %s %s",j,msg1,msg2,msg3);
-
- /* Clear the screen in a roundabout way using qputch */
-
- for (j=80, k=25, m=n=1; j >= m && k >= n; j--, k--, m++, n++)
- {
- for (x = m; x <= j; x++)
- qputch(x,n,7,' ');
- for (y = n; y <= k; y++)
- qputch(m,y,7,' ');
- for (x = j; x >= m; x--)
- qputch(x,k,7,' ');
- for (y = k; y >= n; y--)
- qputch(j,y,7,' ');
- }
- }
-
- void cpdemo(void)
- {
- int x,y,j,k,m,n;
- char *msg1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- char *msg2 = "abcdefghijklmnopqrstuvwxyz";
- char *msg3 = "0123456789";
-
- /* Print 15 screens in different colors using cprintf*/
-
- for (j = 1; j <= 15; j++)
- for (y = 1; y <= 25; y++)
- {
- gotoxy(1,y);
- textattr(j);
- cprintf("Color: %2d - %s %s %s",j,msg1,msg2,msg3);
- }
-
- /* Clear the screen in a roundabout way using putch */
-
- textattr(7);
- for (j=79, k=25, m=n=1; j >= m && k >= n; j--, k--, m++, n++)
- {
- for (x = m; x <= j; x++)
- {
- gotoxy(x,n);
- putch(' ');
- }
- for (y = n; y <= k; y++)
- {
- gotoxy(m,y);
- putch(' ');
- }
- for (x = j; x >= m; x--)
- {
- gotoxy(x,k);
- putch(' ');
- }
- for (y = k; y >= n; y--)
- {
- gotoxy(j,y);
- putch(' ');
- }
- }
- }
-